#include "junix.h"

void sig_handler(int signo)
{
	if(signo==SIGINT)
		fprintf(stdout,"SIGINT\n");
	else if(signo==SIGUSR1)
		fprintf(stdout,"SIGUSR1\n");
	else if(signo==SIGUSR2)
		fprintf(stdout,"SIGUSR2\n");
	else 
		fprintf(stdout,"Unknow SIG\n");
}

int main(int argc, char **argv)
{
	if( signal(SIGINT,sig_handler) == SIG_ERR )
		err_sys("signal");

	if( signal(SIGUSR1,sig_handler) == SIG_ERR )
		err_sys("signal");

	if( signal(SIGUSR2,sig_handler) == SIG_ERR )
		err_sys("signal");

	if( signal(SIGPIPE,SIG_IGN) == SIG_ERR )
		err_sys("signal");

	for(;;)
	{
		pause();
	}

	return 0;
}

